﻿<UserControl x:Class="StockholmsStad.Windows.UI.Controls.NameValueControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:StockholmsStad.Windows.UI.Controls"
    Initialized="OnInitialize">

    <Grid HorizontalAlignment="Stretch">
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="gridLabelColumn" />
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition/>
        </Grid.RowDefinitions>
        
        <Label x:Name="label" Grid.Row="0" Grid.Column="0" 
                   Width="{Binding ElementName=ColumnDefinitions[0].Width}" 
                   Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NameValueControl}}, Path=Label}"></Label>
        <TextBox x:Name="textBox" Grid.Row="0" Grid.Column="1" 
                 Width="{Binding ElementName=ColumnDefinitions[1].Width}" 
                 Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NameValueControl}}, Path=Text}" 
                 ToolTip="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NameValueControl}}, Path=ToolTip}" />
    </Grid>

</UserControl>
